<center>
<?php if (!empty($Pagos)) { ?>
	<table width='1200' cellpadding='8' cellspacing='0' style="border-width:1px; border-style:solid; border-color:#000000">
		<tr >
			<td width='100' class="th">Acciones</td>
			<td width='250' class="th">Titulo</td>
            <td width='250' class="th">Concepto</td>
            <td width="100" class="th">Pago</td>
            <td width="100" class="th">Desde</td>
            <td width="100" class="th" >Hasta</td>
            <td width="100" class="th">Importe</td>
		</tr>

		<?php
            $color = ''; 
			$total_cobrado = $total_por_cobrar = 0;
			$mes = 0;
			$xMeses = meses();
            foreach($Pagos as $imp) { 
				if ($color=='#DFECFF')  {$color = '#D3DFF1';} else {$color = '#DFECFF';}  
				if($imp['fecha_pago']>0){
					$total_cobrado = $total_cobrado + $imp['importe'];
				} else {
					$total_por_cobrar = $total_por_cobrar + $imp['importe'];
				}
				
				if($tipo_consulta=='Vencimientos'){
					if($mes!=date("m",$imp['hasta'])) {
						$mes = date("m",$imp['hasta'])*1;
						$mes_actual = $xMeses[$mes]." ".date("Y",$imp['hasta']);
						echo "<tr><td colspan='7'>$mes_actual</td></tr>";
					}
				} elseif($tipo_consulta=='Vigentes'){
					if($mes!=date("m",$imp['desde'])) {
						$mes = date("m",$imp['desde'])*1;
						$mes_actual = $xMeses[$mes]." ".date("Y",$imp['desde']);
						echo "<tr><td colspan='7'>$mes_actual</td></tr>";
					}
				}
				
        ?>
				<tr bgcolor='<?php echo $color;?>' >
					<td align='center' nowrap="nowrap">
						<a href='pagos_editar.php?id=<?php echo $imp['id'];?>'
							title='Editar este Pago'>
							<img src='<?php echo ADMIN;?>img/edit.gif' border='0'/></a>&nbsp;&nbsp;&nbsp;&nbsp;

                            <a href="pagos.php?accion=eliminar&id=<?php echo $imp['id'];?>" title='Eliminar'
                                onclick="return confirm('Est&aacute; seguro de eliminar este Registro?');"><img src='img/del.gif'></a>

					</td>
					<td nowrap="nowrap">
						<?php if(!empty($imp['notas'])){?>
							<a href="#" data-toggle="popover" class='pop' 
								 data-content="<?php echo $imp['notas'];?>" 
								data-original-title="Mis Anotaciones">
								<img src='<?php echo ADMIN;?>/iconos/txt.gif' style='margin-right:5px;' title="Ver Anotaciones"></a>
						<?php } ?>
					
						<?php
							if($imp['publicidad_id']>0){
								//-------------------------------------------------------------
								//                                            es una Publicidad
								//-------------------------------------------------------------
								$titulo = $imp['publicidad']['titulo'];
							} else {
								//-------------------------------------------------------------
								//                                            es un Alojamiento
								//-------------------------------------------------------------
								$titulo = $imp['alojamiento']['titulo'];
							}
							echo $titulo;
						?>
					</td>
					<td nowrap="nowrap">
						<?php
							if($imp['publicidad_id']>0){
								//-------------------------------------------------------------
								//                                            es una Publicidad
								//-------------------------------------------------------------
								$plan = $imp['publicidad']['plan'];
							} else {
								//-------------------------------------------------------------
								//                                            es un Alojamiento
								//-------------------------------------------------------------
								$plan = $imp['alojamiento']['plan'];
							}

							echo $plan;
						?>
					</td>
					<td align="right"><?php if($imp['fecha_pago']>0){echo date("d-m-Y",$imp['fecha_pago']);}?></td>
					<td align="right"><?php echo date("d-m-Y",$imp['desde']);?></td>
					<td align="right"><?php echo date("d-m-Y",$imp['hasta']);?></td>
					<td align="right">
						<?php echo number_format($imp['importe'],2);?>
					</td>
					
				</tr>
		<?php } ?>
		<tr >
			<td width='100' class="th">Total Cobrado</td>
			<td width='250' class="th">$<?php echo number_format($total_cobrado,2);?>.-</td>
            <td width='250' class="th"></td>
            <td width="100" class="th"></td>
            <td width="100" class="th"></td>
            <td width="100" class="th" >Por Cobrar:</td>
            <td width="100" class="th">$<?php echo number_format($total_por_cobrar,2);?>.-</td>
		</tr>
	</table>
	<script>
		$('.pop').popover();
	</script>
	
<?php }?>
